<?php

namespace app\admin\controller;

class ComponentPurchased extends Base
{
    public $lists_fields = 'id,name,number,sn,notes,status';

    public function filter(&$map, &$field)
    {
        //数据表字段
        $field = $this->lists_fields;

        //回收站
        $status = request()->get('status', 0);
        if($status == 3)
        {
            $map = [['status', '=', '3']];
        }else{
            $map = [['status', 'in', '1,2']];
        }

        //外购件名称
        $title = input('name');
        if(!empty($title)){
            $map[] = ['name', 'like', '%'.$title.'%'];
        }

        //编号
        $title = input('sn');
        if(!empty($title)){
            $map[] = ['sn', 'like', '%'.$title.'%'];
        }

    }


}